package com.turing.usdtpay.mvp.view.popwindow;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.turing.usdtpay.R;

/**
 * @作者：JAY
 * @创建时间：2019/10/17 11:27
 * @描述：
 **/
public class PayTypePopWindow extends CommonPopupWindow{

    private TextView mAliPay,mWeChatPay;
    private OnClickListener listener;
    public PayTypePopWindow(Context context, int layoutRes, int width, int height) {
        super(context, layoutRes, width, height);
    }

    @Override
    protected void initView() {
        mAliPay = (TextView) mContentView.findViewById(R.id.tv_alipay);
        mWeChatPay = (TextView) mContentView.findViewById(R.id.tv_wechat);
        mAliPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null){
                    listener.onClick(1);
                    dismiss();
                }
            }
        });
        mWeChatPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null){
                    listener.onClick(2);
                    dismiss();
                }
            }
        });
    }


    public void dismiss(){mInstance.dismiss();}

    public void setListener(OnClickListener listener) {
        this.listener = listener;
    }

    public interface OnClickListener{
        public void onClick(int type);
    }


    public void showAsDropDown(View anchor) {
        mInstance.showAsDropDown(anchor);
    }
}
